<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;

class CreateRulesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('rules', function (Blueprint $table) {
            $table->increments('id');
            $table->string('title', 60)->default('')->comment('权限名字');
            $table->string('url', 60)->default('')->comment('接口权限地址');
            $table->integer('parent_menu_id')->default(0)->comment('主功能对应的主菜单ID');
            $table->integer('menu_id')->default(0)->comment('主功能对应的子菜单ID , 在决定角色权限时 , 以子菜单为分类单位, 将权限分组');
            $table->timestamps();
        });

        DB::statement("ALTER TABLE `rules` comment '权限表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('rules');
    }
}
